<?php
namespace app\controller\admin\design;

use app\BaseController;
use app\model\SettingModel;

// use app\model\BannerModel;
use think\facade\Request;

class Customer extends BaseController{


    public function index(){

        $info = [];
        $list = SettingModel::getByCode('customer_center');
        foreach( $list as $item ){
            $info[$item['key']] = $item['value'];
        }

        return json( $info );

    }


    public function edit(){


        $bg_img = Request::param('bg_img');
        $entry_box = Request::param('entry_box');

        $entry_box = intval( $entry_box );
        // $bg_img = $_POST['bg_img'] ? $_POST['bg_img'] : '';
        // $entry_box = $_POST['entry_box'] ? $_POST['entry_box'] : 0;
        $ret = 0;

        if( $bg_img ){
            SettingModel::set2( 'customer_center','bg_img', $bg_img );
        }

        SettingModel::set2( 'customer_center','entry_box', $entry_box );

        $res = [
            'status'=>0,
        ];

        return json( $res );

    }

}